//
//  EditDataCell.m
//  MZJ
//
//  Created by XDD on 16/6/4.
//  Copyright © 2016年 XDD. All rights reserved.
//

#import "EditDataCell.h"

@interface EditDataCell()<UITextFieldDelegate>



@end

@implementation EditDataCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
//    _headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(115, 10, 50, 50)];
//    _headImageView.backgroundColor = [UIColor purpleColor];
//    _headImageView.layer.cornerRadius = 25.0;
//    _headImageView.layer.masksToBounds = YES;
//    [self.contentView addSubview:_headImageView];
    
    _chooseBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    _chooseBtn.frame = CGRectMake(115, 10, 40, 26);
    _chooseBtn.backgroundColor = [UIColor yellowColor];
    [_chooseBtn addTarget:self action:@selector(chooseBtnAction) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_chooseBtn];
    
    _chooseImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 5, 16, 16)];
    _chooseImageView.backgroundColor = [UIColor greenColor];
    [_chooseBtn addSubview:_chooseImageView];

    _chooseLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 5, 16, 16)];
    _chooseLabel.text = @"男";
    _chooseLabel.font = [UIFont systemFontOfSize:13];
    [_chooseBtn addSubview:_chooseLabel];

    _chooseBtn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    _chooseBtn1.frame = CGRectMake(205, 10, 40, 26);
    _chooseBtn1.backgroundColor = [UIColor yellowColor];
    [_chooseBtn1 addTarget:self action:@selector(chooseBtn1Action) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_chooseBtn1];
    
    _chooseImageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 5, 16, 16)];
    _chooseImageView1.backgroundColor = [UIColor greenColor];
    [_chooseBtn1 addSubview:_chooseImageView1];
    
    _chooseLabel1 = [[UILabel alloc]initWithFrame:CGRectMake(20, 5, 16, 16)];
    _chooseLabel1.text = @"女";
    _chooseLabel1.font = [UIFont systemFontOfSize:13];
    [_chooseBtn1 addSubview:_chooseLabel1];
    
    self.editDataTextField.delegate = self;
}

- (void)chooseBtnAction {
    if (self.didSexSelectedCellBlock) {
        self.didSexSelectedCellBlock(self);
    }
}

- (void)chooseBtn1Action {
    if (self.didOtherSelectedCellBlock) {
        self.didOtherSelectedCellBlock(self);
    }
}

- (void)textFieldDidEndEditing:(UITextField *)textField {

    if (self.didEditTextfieldBlock) {
        self.didEditTextfieldBlock(self);
    }
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {

    [self.editDataTextField resignFirstResponder];
    return YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    
    [super setSelected:selected animated:animated];
}

@end
